package com.xiangban.controller;


import com.xiangban.aop.Permission;
import com.xiangban.model.TUser;
import com.xiangban.model.TUserOpenId;
import com.xiangban.model.res.ApiResult;
import com.xiangban.service.UserInfoService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author ly
 * @date 2021/11/16 11:53
 */
@RestController
@Slf4j
@RequestMapping("/api/user")
@Api("用户注册修改操作台")
public class UserInfoController {
    @Autowired
    private UserInfoService userInfoService;
    @ApiOperation("用户注册")
    @PostMapping("UserRegistration")
  public Object UserRegistration(@RequestBody TUser tUser){//用户注册必备参数：除了微信号 创建时间和修改时间不要

      return userInfoService.UserRegistration(tUser);
    }
    @ApiOperation("用户修改")
    @PostMapping("UserUpdate")
    public ApiResult<Object> UserUpdate(@RequestBody TUserOpenId tUserOpenId){
        userInfoService.UserUpdate(tUserOpenId);
        return ApiResult.newSuccess();


    }
    @ApiOperation("获取用户信息")
    @PostMapping("/getUserInfo")
    public ApiResult<Object> getUserInfo(){
        return ApiResult.newSuccess(userInfoService.getUserInfo());
    }


}
